#include <bits/stdc++.h>
using namespace std;
struct D {
	int v, id;
} a[8005];
int n, q;
int op, x, y;
bool cmp(D a, D b) {
	if(a.v == b.v) return a.id < b.id;
	return a.v < b.v;
} 
int main() {
	freopen("sort.in", "r", stdin);
	freopen("sort.out", "w", stdout);
	cin >> n >> q;
	for(int i = 1; i <= n; i++)
		cin >> a[i].v, a[i].id = i;
	sort(a + 1, a + n + 1, cmp);
	while(q--) {
		scanf("%d %d", &op, &x);
		if(op == 1) {
			scanf("%d", &y);
			int xb = 0;
			for(int i = 1; i <= n; i++)
				if(a[i].id == x) {
					xb = i;
					break;
				} 
			int l = a[xb].id, i;
			for(i = xb; i < n; i++) {
				if(a[i + 1].v > y) break;
				if(a[i + 1].v == y)
					if(a[i + 1].id > l) break;
				a[i].id = a[i + 1].id;
				a[i].v = a[i + 1].v;
			} 
			a[i].v = y;
			a[i].id = l;
			for(i = xb - 1; i > 0; i--) {
				if(y > a[i].v) break;
				if(a[i].v == y)
					if(a[i].id < l) break;
				a[i + 1].id = a[i].id;
				a[i + 1].v = a[i].v;
			} 
			a[i].v = y;
			a[i].id = l;
		} 
		else {
			for(int i = 1; i <= n; i++)
				if(a[i].id == x) {
					printf("%d\n", i);
					break;
				} 
		} 
	} 
	return 0;
} 
